﻿//using System;
//using System.Collections.Generic;
//using System.Data;
//using System.Data.SqlClient;
//using System.Linq.Expressions;
//using Dapper;

//namespace Infrastructure.Dapper
//{
//    public interface ISqlDapper
//    {
//        /// <summary>
//        ///  超时时间(秒)2021.05.05
//        /// </summary>
//        /// <param name="timeout"></param>
//        /// <returns></returns>
//        ISqlDapper SetTimout(int timeout);

//        void BeginTransaction(Func<ISqlDapper, bool> action, Action<Exception> error);

//        /// <summary>
//        /// var p = new object();
//        //        p.Add("@a", 11);
//        //p.Add("@b", dbType: DbType.Int32, direction: ParameterDirection.Output);
//        //p.Add("@c", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue);
//        ////        /// </summary>
//        /// <typeparam name="T"></typeparam>
//        /// <param name="sql"></param>
//        /// <param name="param"></param>
//        /// <param name="commandType"></param>
//        /// <returns></returns>
//        List<T> QueryList<T>(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false) where T : class;
//        /// <summary>
//        /// 查询数据
//        /// </summary>
//        /// <typeparam name="T"></typeparam>
//        /// <param name="cmd"></param>
//        /// <param name="param"></param>
//        /// <param name="commandType"></param>
//        /// <param name="beginTransaction"></param>
//        /// <returns></returns>
//        T QueryFirst<T>(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false) where T : class;

//        /// <summary>
//        /// 执行sql语句
//        /// </summary>
//        /// <param name="cmd"></param>
//        /// <param name="param"></param>
//        /// <param name="commandType"></param>
//        /// <param name="beginTransaction"></param>
//        /// <returns></returns>
//        int ExcuteNonQuery(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false);

//        /// <summary>
//        /// 查询sql语句 第一行第一列
//        /// </summary>
//        /// <param name="cmd"></param>
//        /// <param name="param"></param>
//        /// <param name="commandType"></param>
//        /// <param name="beginTransaction"></param>
//        /// <returns></returns>
//        object ExecuteScalar(string cmd, object param, CommandType? commandType = null, bool beginTransaction = false);


//        /// <summary>
//        /// 
//        /// </summary>
//        /// <typeparam name="T"></typeparam>
//        /// <param name="entities"></param>
//        /// <param name="updateFileds">指定插入的字段</param>
//        /// <param name="beginTransaction">是否开启事务</param>
//        /// <returns></returns>
//        int Insert<T>(T entity, bool beginTransaction = false);
//        /// <summary>
//        /// 
//        /// </summary>
//        /// <typeparam name="T"></typeparam>
//        /// <param name="entities"></param>
//        /// <param name="updateFileds">指定插入的字段</param>
//        /// <param name="beginTransaction">是否开启事务</param>
//        /// <returns></returns>
//        int Insert<T>(IEnumerable<T> entities, bool beginTransaction = false);


//        /// <summary>
//        /// sqlserver使用的临时表参数化批量更新，mysql批量更新待发开
//        /// </summary>
//        /// <typeparam name="T"></typeparam>
//        /// <param name="entity">实体必须带主键</param>
//        /// <param name="updateFileds">指定更新的字段x=new {x.a,x.b}</param>
//        /// <param name="beginTransaction">是否开启事务</param>
//        /// <returns></returns>
//        int Update<T>(T entity, Expression<Func<T, object>> updateFileds = null, bool beginTransaction = false);

//        /// <summary>
//        /// sqlserver使用的临时表参数化批量更新，mysql批量更新待发开
//        /// </summary>
//        /// <typeparam name="T"></typeparam>
//        /// <param name="entity">实体必须带主键</param>
//        /// <param name="updateFileds">指定更新的字段x=new {x.a,x.b}</param>
//        /// <param name="beginTransaction">是否开启事务</param>
//        /// <returns></returns>
//        int Update<T>(IEnumerable<T> entities, Expression<Func<T, object>> updateFileds = null, bool beginTransaction = false);

//        /// <summary>
//        /// sqlserver使用的临时表参数化批量更新，mysql批量更新待发开
//        /// </summary>
//        /// <typeparam name="T"></typeparam>
//        /// <param name="key">实体必须带主键</param>
//        /// <param name="beginTransaction">是否开启事务</param>
//        /// <returns></returns>
//        int Delete<T>(string key);

//        /// <summary>
//        /// sqlserver使用的临时表参数化批量更新，mysql批量更新待发开
//        /// </summary>
//        /// <typeparam name="T"></typeparam>
//        /// <param name="key">实体必须带主键</param>
//        /// <param name="beginTransaction">是否开启事务</param>
//        /// <returns></returns>
//        int Delete<T>(IEnumerable<string> keys);
//    }
//}